package com.esri.core.symbol.advanced;

import android.graphics.Bitmap;
import android.util.Log;
import com.esri.core.internal.RuntimeHelper;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

/* loaded from: classes.dex */
public class SymbolDictionary {
    private static final String a = "/sdcard/ArcGIS/SymbolDictionary/";
    private SymbolDictionaryImpl b;
    private DictionaryType c;
    private long d;
    private LinkedHashMap<String, ArrayList<String>> e;
    private ArrayList<String> f;

    private static native String[] nativeGetFilterNames(long j);

    private static native String[] nativeGetFilterValues(long j, String str);

    private static native String[] nativeGetKeywords(long j);

    private static native String nativeGetSymbolKeywords(String str, String str2);

    private static native String[] nativeGetSymbolNames(long j, String[] strArr, String[] strArr2, String[] strArr3);

    private static native String[][] nativeGetSymbolValues(String str, String str2);

    /* loaded from: classes.dex */
    public enum DictionaryType {
        MIL2525C("Mil2525C"),
        APP6B("App6B");
        
        String a;

        DictionaryType(String str) {
            this.a = str;
        }

        @Override // java.lang.Enum
        public String toString() {
            return this.a;
        }
    }

    public SymbolDictionary(DictionaryType dictionaryType) throws FileNotFoundException {
        this(dictionaryType, a);
    }

    public SymbolDictionary(DictionaryType dictionaryType, String str) throws FileNotFoundException {
        this.d = 0L;
        this.e = null;
        this.f = null;
        if (str == null || str.trim().equals("")) {
            throw new FileNotFoundException("A complete path to the dictionary file must be provided.");
        }
        this.c = dictionaryType;
        if (!new File(str, this.c.toString() + ".dat").exists()) {
            throw new FileNotFoundException("The dictionary could not be found at the location provided: " + str);
        }
        SymbolDictionaryImpl symbolDictionaryImpl = new SymbolDictionaryImpl(dictionaryType, str);
        this.b = symbolDictionaryImpl;
        this.d = symbolDictionaryImpl.a;
    }

    public boolean getSymbolImage(String str, Bitmap bitmap) {
        SymbolDictionaryImpl symbolDictionaryImpl = this.b;
        if (symbolDictionaryImpl == null || str == null) {
            return false;
        }
        if (symbolDictionaryImpl.a(str, bitmap)) {
            return true;
        }
        Log.w("SymbolDictionary", String.format("The image for the symbol %1$s could not be retrieved.", str));
        return false;
    }

    @Deprecated
    public Set<String> getFilterNames() {
        if (this.d == 0) {
            return null;
        }
        if (this.e == null) {
            a();
        }
        return this.e.keySet();
    }

    private void a() {
        if (this.d == 0) {
            return;
        }
        this.e = new LinkedHashMap<>();
        String[] nativeGetFilterNames = nativeGetFilterNames(this.d);
        if (nativeGetFilterNames != null) {
            for (String str : nativeGetFilterNames) {
                this.e.put(str, null);
            }
        }
    }

    public List<String> getKeywords() {
        return this.b.a();
    }

    public Map<String, List<String>> getFilters() {
        return this.b.b();
    }

    public List<SymbolProperties> findSymbols() throws IOException {
        return findSymbols(null, null);
    }

    public List<SymbolProperties> findSymbols(List<String> list) throws IOException {
        return findSymbols(list, null);
    }

    public List<SymbolProperties> findSymbols(Map<String, List<String>> map) {
        return findSymbols(null, map);
    }

    public List<SymbolProperties> findSymbols(List<String> list, Map<String, List<String>> map) {
        return this.b.a(list, map);
    }

    static {
        RuntimeHelper.initialize();
    }
}
